package org.corey.wyp.business;

import java.util.Date;

import org.corey.wyp.vo.AccountItem;
import org.corey.wyp.vo.Calendar;
import org.corey.wyp.vo.Month;
import org.corey.wyp.vo.MonthSetting;

public class MockPropertyManager {
	
	public static int id=0;
	
	public Integer saveAccountItem(AccountItem accountItem){
		System.out.println(accountItem.getItemName());
		System.out.println(accountItem.getCalendar().getYear());
		id++;
		return id;
	}


	/******************************** SettingTemplate operation *********************/
	

	/******************************** SettingTemplate operation *********************/

	public String testConnection(String seedString) {
		return "server response:" + seedString;
	}
	
	public Calendar getServerTime(){
		System.out.println("server:getServerTime");
		Calendar today=new Calendar();
		Date d=new Date();
		today.setId(id);
		id++;
		today.setYear(d.getYear());
		today.setMonth(d.getMonth());
		today.setDate(d.getDate());
		return today;
	}
	
	public Calendar getCalendarAccount(final int year, final int month,
			final int date){
		Calendar c=new Calendar();
		c.setId(1);
		c.setYear(1111);
		c.setMonth(11);
		c.setDate(11);
		
		AccountItem i1=new AccountItem();
		i1.setId(5);
		i1.setItemName("i1");
		i1.setItemType("i2");
		i1.setItemOut(22.1f);
		
		AccountItem i2=new AccountItem();
		i2.setId(6);
		i2.setItemName("i1");
		i2.setItemType("i2");
		i2.setItemOut(22.1f);
		
		AccountItem i3=new AccountItem();
		i3.setId(7);
		i3.setItemName("i3");
		i3.setItemType("i3");
		i3.setItemOut(22.1f);
		
		c.getAccountItems().add(i1);
		c.getAccountItems().add(i2);
		c.getAccountItems().add(i3);
		
		return c;
	}
	
	public Month getMonth(int year,int month){
		System.out.println("getMonth");
		Calendar c=new Calendar();
		c.setId(1);
		c.setYear(1111);
		c.setMonth(11);
		c.setDate(11);
		
		AccountItem i1=new AccountItem();
		i1.setId(5);
		i1.setItemName("i1");
		i1.setItemType("i2");
		i1.setItemOut(35);
	
		
		c.getAccountItems().add(i1);
		
		Calendar c2=new Calendar();
		c2.setId(2);
		c2.setYear(1111);
		c2.setMonth(11);
		c2.setDate(1);
		
		
		AccountItem i2=new AccountItem();
		i2.setId(6);
		i2.setItemName("i1");
		i2.setItemType("i2");
		i2.setItemOut(40);
		
		AccountItem i3=new AccountItem();
		i3.setId(7);
		i3.setItemName("i3");
		i3.setItemType("i3");
		i3.setItemOut(40);
		
		c2.getAccountItems().add(i2);
		c2.getAccountItems().add(i3);
		
		Month m=new Month();
		
		m.getDays().add(c);
		m.getDays().add(c2);
		
		return m;
	}
	
	public MonthSetting getMonthSetting(int year,int month){
		System.out.println("getMonthSetting");
		MonthSetting s=new MonthSetting();
		s.setYear(year);
		s.setMonth(month);
		s.setMonthIncoming(4500);
		return s;
	}
}
